package com.ioc;

import com.ioc.config.SpringConfig;
import com.ioc.dao.BookDao;
import com.ioc.dao.UserDao;
import com.ioc.dao.impl.UserDaoImpl;
import com.ioc.proxy.CglibDynamicProxy;
import com.ioc.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**

 *
 */
public class CglibTest01 {


    public static void main(String[] args) {
        //1 创建目标对象
        UserDao userDao = new UserDaoImpl();
        //2 创建JdkDynamicProxy
        CglibDynamicProxy cglibDynamicProxy = new CglibDynamicProxy(userDao);
        //3 调用JdkDynamicProxy对象中的getProxyObject方法生成代理对象
        UserDao proxyObject = (UserDao) cglibDynamicProxy.getProxyObject();
        //4 执行
        proxyObject.save();

    }



}
